<?php
/**
 * @package scuttle
 * @file /forms/TagsFilterForm.class.php
 **/

if (!defined('XOOPS_ROOT_PATH')) exit();

require_once XOOPS_MODULE_PATH . '/scuttle/class/AbstractFilterForm.class.php';

define('SC_SORT_KEY_ID', 1);
define('SC_SORT_KEY_BID', 2);
define('SC_SORT_KEY_TAG', 3);


define('SC_SORT_KEY_DEFAULT', SC_SORT_KEY_ID);

class Scuttle_TagsFilterForm extends Scuttle_AbstractFilterForm
{
	var $mSortKeys = array(
		SC_SORT_KEY_ID => 'id',
		SC_SORT_KEY_BID => 'bId',
		SC_SORT_KEY_TAG => 'tag',
	);
	function getDefaultSortKey()
	{
		return SC_SORT_KEY_DEFAULT;
	}

	function fetch()
	{
		parent::fetch();

		if (isset($_REQUEST['id'])) {
			$this->mNavi->addExtra('id', xoops_getrequest('id'));
			$this->_mCriteria->add(new Criteria('id', xoops_getrequest('id')));
		}

		if (isset($_REQUEST['bId'])) {
			$this->mNavi->addExtra('bId', xoops_getrequest('bId'));
			$this->_mCriteria->add(new Criteria('bId', xoops_getrequest('bId')));
		}

		if (isset($_REQUEST['tag'])) {
			$this->mNavi->addExtra('tag', xoops_getrequest('tag'));
			$this->_mCriteria->add(new Criteria('tag', xoops_getrequest('tag')));
		}

		$this->_mCriteria->addSort($this->getSort(), $this->getOrder());

	}
}

?>